package com.whfc.ms.api.hdc.service.impl;

import com.whfc.common.result.PageData;
import com.whfc.hdc.dto.AlgDeviceDataDTO;
import com.whfc.hdc.enums.AlgConfigCode;
import com.whfc.hdc.params.AlgDeviceConfigParam;
import com.whfc.hdc.service.AlgDeviceConfigService;
import com.whfc.hdc.service.AlgDeviceDataService;
import com.whfc.ms.api.hdc.service.MsAlgService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author qzexing
 * @version 1.0
 * @date 2021-07-19 16:31
 */
@Service
public class MsAlgServiceImpl implements MsAlgService {

    @DubboReference(interfaceClass = AlgDeviceDataService.class, version = "1.0.0")
    private AlgDeviceDataService algDeviceDataService;

    @DubboReference(interfaceClass = AlgDeviceConfigService.class, version = "1.0.0")
    private AlgDeviceConfigService algDeviceConfigService;


    @Override
    public PageData<AlgDeviceDataDTO> list(Integer pageNum, Integer pageSize, String keyword) {
        return algDeviceDataService.list(pageNum, pageSize, keyword);
    }

    @Override
    public PageData<AlgDeviceDataDTO> getDataLog(String sn, Integer pageNum, Integer pageSize, Date startTime, Date endTime) {
        return algDeviceDataService.getDataLog(sn, pageNum, pageSize, startTime, endTime);
    }

    @Override
    public List<String> getConfig(String sn, String configCode) {
        return algDeviceConfigService.getConfig(sn, AlgConfigCode.parseValue(configCode));
    }

    @Override
    public void setConfig(AlgDeviceConfigParam params) {
        algDeviceConfigService.setConfig(params);
    }

}
